<?php
class regx {
    public static function check($str) {
        if (preg_match('/^([1-9,])+$/', $str)){
            return true;
        }
        return false;
    }
}

$str = '12d34,34';
var_dump(regx::check($str));